package org.colcon.web.model.proposal;

import org.colcon.web.model.Model;
import org.colcon.web.model.framework.ITitle;
import org.colcon.web.model.framework.IUser;
import org.colcon.web.model.framework.IVote;
import org.colcon.web.model.vote.ElectionVote;

public class ElectionVoteProposal extends MultiChoiceVoteProposal
{
	private static final long serialVersionUID = 7229316851830982407L;
	
	private ITitle title;
	
	private int voteThreshold;
	
	public ElectionVoteProposal()
	{
		this(Model.NULL, Model.NULL, 0, 0, null, 0, 0, 0, null);
	}
	
	public ElectionVoteProposal(String group, String id, int length, int quorum, String[] voters, int voteLength, int voteQuorum, int voteThreshold, ITitle title) 
	{
		super(group, id, length, quorum, voters, voteLength, voteQuorum);
		
		this.voteThreshold = voteThreshold;
		this.title = title;
	}
	
	public int getVoteThreshold()
	{
		return voteThreshold;
	}

	public IVote getVote()
	{
		return new ElectionVote(getGroup(), getId(), getVoteLength(), getVoteQuorum(), getVoteThreshold(), getRequiredTitles(), title, getChoices().toArray(new IUser[0]));
	}
	
	public String getText()
	{
		return "This vote will determine the candidates for the following title: " + title.getLongName();
	}
}
